/*
 * @Author: yanjikun
 * @Date: 2021-06-17 16:37:13
 * @LastEditors: yanjikun
 * @LastEditTime: 2021-11-04 18:03:46
 * @Description: file content
 */

import { useUserStore } from '@/store/modules/user'

const LoadingInstance = {
  _count: 0
}

export function addLoading() {
  LoadingInstance._count++
  const store = useUserStore()
  if (LoadingInstance._count === 1) {
    store.setLoading(true)
  }
}

export function removeLoading() {
  LoadingInstance._count--
  const store = useUserStore()
  if (LoadingInstance._count === 0) {
    store.setLoading(false)
  }
}
